import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
     count: 0
   },
   mutations: {//commit
     increment (state,value) {
       state.count+=value
			 console.log(state.count)
     }
   },
   actions: {//dispatch
     increment (state,value) {
			 setTimeout(function(){ //setInterval .then
				 state.commit('increment',value)
				 console.log(value)
			 },1000)
     }
   },
  modules: {
  }
})
